function config = writeFileLists( config )

    dataset_n  = length( config.datasets );

    for dataset_i = 1: dataset_n

        config.datasets{ dataset_i }  = ...
            writeFileList( config.datasets{ dataset_i } , config.file_list_root);

    end
end

function config = writeFileList( config , list_root)
%config : one dataset
%write the file list

    veb = 1;
    
    n = length( config.src_list );
    
    fout_src_name = [list_root config.name '_src.txt'];
    fout_gt_name = [list_root config.name '_gt.txt'];
    
    fout_src = fopen(fout_src_name, 'wt');
    fout_gt  = fopen(fout_gt_name , 'wt');
    
    fprintf( fout_src ,'%d\n', n );
    fprintf( fout_gt  ,'%d\n', n );
    
    for j = 1:n
        fprintf( fout_src , '%s\n', [config.src_root config.src_list{j}] );
        fprintf( fout_gt  , '%s\n', [config.gt_root  config.gt_list{j} ] );
    end
    
    fclose( fout_src );
    fclose( fout_gt );
       
end